CC = g++
CFLAGS  =  -Wall -g   -Wno-reorder -D_REENTRANT -DRELEASE -DIPLIB -DENCRYPT -fno-strict-aliasing
LDLIBS  =  -lmysqlclient -lpthread -ldl  -leastl -lz  -liconv

OBJ_DIRS=  ../comm ../ip_database ../res ../brc ../server/jsoncpp/src/json ../log
SOURCES = $(foreach dir, $(OBJ_DIRS), $(wildcard $(dir)/*.cpp))
OBJS    = $(patsubst %.cpp, %.o, $(SOURCES))

INCLUDE  = -I../server
INCLUDE += -I../comm 
INCLUDE += -I../comm/mysql/include/mysql
INCLUDE += -I ../comm/eastl_lib/include
INCLUDE += -I ../server/jsoncpp/include
 

LIB_PATH =  -L../comm/mysql/lib
LIB_PATH += -L../comm/eastl_lib/src 

TARGETS = kingflower_brc


all : $(TARGETS)


.PHONY: all clean


%.o:%.cpp 
	$(CC) -c $(CFLAGS) $(CPPFLAGS)  $(INCLUDE) $^ -o $@

$(TARGETS): $(OBJS)
	@echo "objs : " $(OBJS)
	$(CC)  -o $(TARGETS)  $(OBJS) $(LIB_PATH) $(CFLAGS)  $(LDLIBS) -Wl,-rpath,./


clean :
	rm $(TARGETS) $(OBJS)  -f
clear:
#	find . -type f -exec touch {} \;
	rm *.o -rf
